Skip to main content

Foodsystem

Introduction

Are you tired of lackluster food systems in your FiveM server? Say goodbye to bland and boring meal mechanics and say hello to the next level of immersive gameplay! Our unique Food System script revolutionizes the dining experience in your virtual world, offering a plethora of features that will keep your players engaged and craving for more.

Get it now!

Installation

  1. Put ensure sqz_foodsystem to your server.cfg (or any start cfg file) and put the resource named sqz_foodsystem -maybe you will have to rename it- into your resources folder.
  2. Download dependencies: ox_lib, ox_target
  3. Insert new animations to your emotes menu:
  • Into bk_emotes/Client/AnimationList.lua , DP.PropEmotes table insert:
["carryplates"] = {"anim@heists@box_carry@", "idle", "Carry Plates", AnimationOptions =
{
Prop = "prop_cs_plate_01",
PropBone = 60309,
PropPlacement = {0.09, -0.04, 0.11, -100.0, 40.0, 40.0},
SecondProp = 'prop_cs_plate_01',
SecondPropBone = 57005,
SecondPropPlacement = {0.18, -0.01, -0.11, -110.0, -10.0, 30.0},
EmoteLoop = true,
EmoteMoving = true,
}},
["carrydrinks"] = {"anim@heists@humane_labs@finale@keycards", "ped_a_enter_loop", "Carry Drinks", AnimationOptions =
{
Prop = 'v_ret_247_popcan2',
PropBone = 18905,
PropPlacement = {0.12, 0.12, -0.02, -104.0, 27.0, -19.0},
EmoteMoving = true,
EmoteLoop = true
}},
  1. Remove esx_basicneeds script from your server (now food part is handled by this script) or remove at least from client/main.lua this part:
AddEventHandler('esx_status:loaded', function(status)
TriggerEvent('esx_status:registerStatus', 'hunger', 1000000, '#CFAD0F', function(status)
return Config.Visible
end, function(status)
status.remove(100)
end)

TriggerEvent('esx_status:registerStatus', 'thirst', 1000000, '#0C98F1', function(status)
return Config.Visible
end, function(status)
status.remove(75)
end)
end)

AddEventHandler('esx_status:onTick', function(data)
local playerPed = PlayerPedId()
local prevHealth = GetEntityHealth(playerPed)
local health = prevHealth

for k, v in pairs(data) do
if v.name == 'hunger' and v.percent == 0 then
if prevHealth <= 150 then
health = health - 5
else
health = health - 1
end
elseif v.name == 'thirst' and v.percent == 0 then
if prevHealth <= 150 then
health = health - 5
else
health = health - 1
end
end
end

if health ~= prevHealth then SetEntityHealth(playerPed, health) end
end)